/*
package com.deercrowing.takeaway.asperct;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.security.crypto.encrypt.RsaRawEncryptor;
import org.springframework.stereotype.Component;

import java.security.KeyPair;

@Slf4j
@Aspect
@Component
public class DecryptAspect {

    KeyPair keyPair = new KeyPair(keyPairProperties.getPublicKey(), keyPairProperties.getPrivateKey());
    RsaRawEncryptor rawEncryptor = new RsaRawEncryptor(keyPair);
    */
/**
     * 定义切点表达式
     * 拦截登录接口，解密完成后放行
     *//*

    @Pointcut("execution(* com.deercrowing.takeaway.controller.admin.EmployeesController.login())")
    public void decrypt(){}

    @Before("decrypt()")
    public Object before(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] args = joinPoint.getArgs();

        // 对接口内信息进行rsa解密
        for (int i = 0; i < args.length; i++) {
            if (args[i] instanceof String) {
                args[i] = rawEncryptor.decrypt((String) args[i]);
            }
        }

        return joinPoint.proceed(args);
    }
}
*/
